
package galaxy.app.network.rpc.handler;

import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;

import galaxy.app.Galaxy;
import galaxy.app.event.EventSystem;
import galaxy.app.event.GameEvent;
import galaxy.app.log.LogHelper;

/**
 * GameEvent msg receive handler
 *
 */
@Sharable
public class GameEventHandler extends BaseChannelHandler<GameEvent> {

    EventSystem event;

    public GameEventHandler() {
        super(GameEvent.class);

        event = Galaxy.systems().get(EventSystem.class);
    }

    @Override
    protected void onChannelRead(ChannelHandlerContext ctx, GameEvent packet) {
        LogHelper.info("<---------- GameEvent  {}", packet);
        event.post(packet);
    }
}
